Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ResponseOps][Connectors] Add support of additional fields for ServiceNow ITSM and SecOps #184023

Merged
merged 35 commits into from
Jun 13, 2024

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented May 22, 2024

Summary

This PR adds support for additional fields for the ServiceNow ITSM and SecOps connector. The additional fields will not be available to the recovered action.

Screenshot 2024-05-27 at 6 29 26 PM

Testing

Verify that:

  1. Existing rules with ITSM and SecOps configured continue working as expected.
  2. Can create rules with an ITSM action and set some additional fields supported by ITSM. You can find the available in the Elastic transformation map inside ServiceNow.
  3. The "additional fields" verification in the UI is working as expected.
  4. The "additional fields" are not shown when you set a recovered action.

Fixes: #183609

Checklist

Delete any items that are not applicable to this PR.

For maintainers

Release notes

Pass any field to ServiceNow using the ServiceNow ITSM and SecOps connectors with a JSON field called "additional fields".

@cnasikas cnasikas added release_note:enhancement Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Actions/ConnectorTypes Issues related to specific Connector Types on the Actions Framework v8.15.0 labels May 22, 2024
@cnasikas cnasikas self-assigned this May 22, 2024
@cnasikas
Copy link
Member Author

/ci

@cnasikas cnasikas marked this pull request as ready for review May 27, 2024 13:57
@cnasikas cnasikas requested a review from a team as a code owner May 27, 2024 13:57
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks pretty good, just some nitpicks. Will test the behaviour tomorrow.

we need to store the current state. To match with the data structure define in the backend, we make sure users can't
send the form while not matching the original object structure. */
subActionParams: ExecutorSubActionPushParamsSIR & {
incident: { additional_fields: string | null };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what type is this? in the schema file it says additional_fields is a Record<string, any>, here its a string | null

Copy link
Member Author

@cnasikas cnasikas May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. The frontend sends a string (JSON.stringify(additional_fields)) and the backend parses the string converts it to an object and then validates it. The backend will always have a record (object) after the validation. This is happening automatically by the kbn-schema. This is how all connectors work so far including the webhook connector. An alternative would be to do the parse + validation on the front end and send always a record. Would you like me to do something like that? Any other ideas?

Copy link
Contributor

@JiaweiWu JiaweiWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to verify on the UI side, everything is working as expected. The additional field is validated correctly and will disappear when alert triggers on recover.

However I triggers an ITSM action with an alert and was not able to see any incidents. I think it's probably because I configured something incorrectly. I used the information you provided in slack. Let me know if you need more information.

@cnasikas
Copy link
Member Author

@elasticmachine merge upstream

@cnasikas cnasikas requested a review from a team as a code owner May 30, 2024 13:54
Copy link
Member

@maryam-saeidi maryam-saeidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test change LGTM!

@cnasikas
Copy link
Member Author

cnasikas commented Jun 3, 2024

@elasticmachine merge upstream

@cnasikas
Copy link
Member Author

cnasikas commented Jun 12, 2024

I added a feature flag to accommodate the intermediate release process in 6a593e9 (#184023).

Testing

  • Verify that you cannot add additional fields to an ITSM and SecOps action in rules from the UI.
  • Create a rule using the API with an ITSM and SecOps action where the additional fields field is set. Verify that you can see the additional fields in the UI.

@cnasikas
Copy link
Member Author

@elasticmachine merge upstream

@adcoelho
Copy link
Contributor

Verify that you cannot add additional fields to an ITSM and SecOps action in rules from the UI.

  • Create a rule using the API with an ITSM and SecOps action where the additional fields field is set.
  • Verify that you can see the additional fields in the UI.

I tested the above and everything is working as expected.

I had an existing Rule(from a previous version of this PR) with ITSM and SecOps actions where additional_fields were defined.

  • If I edit this rule I can see additional fields in the UI
  • If I create a new action the additional fields are not visible
  • Testing connectors also does not display the additional fields

@cnasikas cnasikas enabled auto-merge (squash) June 13, 2024 09:07
@kibana-ci
Copy link
Collaborator

kibana-ci commented Jun 13, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #58 / Dev Tools Search Profiler Editor supports pre-configured search query

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
stackConnectors 258 261 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
stackConnectors 560.7KB 567.4KB +6.7KB
uptime 467.2KB 467.2KB +23.0B
total +6.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
stackConnectors 52.6KB 53.4KB +854.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @cnasikas

@cnasikas cnasikas merged commit 75f3af5 into elastic:main Jun 13, 2024
36 of 37 checks passed
@cnasikas cnasikas deleted the itsm_additional_fields branch June 13, 2024 10:03
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 13, 2024
cnasikas added a commit that referenced this pull request Jun 26, 2024
…al fields (#186949)

## Summary

In #184023, we introduced the
"additional fields" field for ServiceNow ITSM and SecOps. The field was
under a feature flag to follow the intermediate release process. This PR
reverts commit 6a593e9 to remove the
feature flag.

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:review backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project Feature:Actions/ConnectorTypes Issues related to specific Connector Types on the Actions Framework release_note:enhancement Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Custom Fields to ServiceNow ITSM connector
9 participants